<template>
    <div class="layerRtb layerRtb-threecolumn">
        <three-title :title="{name:'处理'}"></three-title>
        <div class="layerRtb-scroll thinScroll" v-scrollHeight="437" v-if="penalty.length>0">
            <div class="analyItem"  v-for="(item,index) in penalty" :key="index">
                <p class="analyItemTit tx-center">处理-{{index+1}}</p>
                <div class="analyItemCon">
                    <p class="col-md-12">时间：
                        <span class="cLightGray pr8">{{item.CreateTime}}</span>
                    </p>
                    <p class="col-md-9">内容：
                        <span class="cLightGray pr8">{{item.TaskContent}}</span>
                    </p>
                    <p class="col-md-3">积分：
                        <span class="cLightGray pr8">{{item.TaskIntegral}}</span>
                    </p>
                </div>
            </div>
        </div>
        <div class="layerRtb-scroll thinScroll" v-scrollHeight="437" v-else>
                <div class="analyItem">
                    <p class="analyItemTit tx-center">处理</p>
                    <div class="analyItemCon">
                        <p class="col-md-12">
                            <span>暂无内容！</span>
                        </p>
                    </div>
                </div>
        </div>
        <div class="layerRtb-footer">
            <div class="analyItem">
                <p class="analyItemTit tx-center">综合</p>
                <div class="analyItemCon">
                        <p class="col-md-4">
                            <span>次数</span>
                            <span>{{penalty.length}}</span>
                        </p>
                        <p class="col-md-4">
                            <span>积分</span>
                            <span>{{compluedTask}}</span>
                        </p>
                        <p class="col-md-4">
                            <span  @click="clickFourShow(0)">历史</span>
                        </p>
                </div>
            </div>
        </div>
          <transition-group class="animated faster" enter-active-class="animated faster slideInRight" leave-active-class="animated faster slideOutRight">
        <!-- 问题 threeresultDetail -->
        <rx-history v-if="fourIndex === 0" :key="0" :basic="basic"></rx-history>
    </transition-group>
    </div>
</template>
<script>
import { mapGetters } from 'vuex'
import { personHandlerIntegralHistory } from '../../Resources/Api/index'
import rxHistory from './history/handlerIntegral'
export default {
    components: {
        rxHistory
    },
    data () {
        return {
            penalty: [],
            fourIndex: undefined,
            money: 0
        }
    },
    created () {
        this.GetDeposit()
    },
    methods: {
        GetDeposit () {
            let _this = this
            _this.penalty = []
            personHandlerIntegralHistory({
                createUserNo: _this.leftInfo.app_cardNo,
                cuurentMonth: '2'
            }).then(results => {
                _this.penalty = results.data.Body
                if (_this.penalty == null) {
                    _this.penalty = []
                }
            }).catch(error => {
                console.log(error)
            })
        },
        clickFourShow (index) {
            this.fourIndex = index
        }
    },
    computed: {
        ...mapGetters(['leftInfo']),
        compluedTask () {
            return this.penalty.map(item => item.TaskIntegral).reduce((acc, cur) => (cur + acc), 0)
        }
    },
    watch: {
        leftInfo () {
            this.GetDeposit()
        }
    }
}


</script>
